package com.aya.activity.demo;

import com.aya.activity.core.model.Goods;
import com.aya.activity.facade.ActivityFacade;
import com.aya.activity.facade.ActivityFacadeBuilder;

import java.math.BigDecimal;

public class DemoBuilder {
    public static void main(String[] args) {
        ActivityFacadeBuilder builder = ActivityFacadeBuilder.newBuilder();

        builder.withDescendService(goodsId -> BigDecimal.valueOf(10));
        builder.withDiscountService(goodsId -> BigDecimal.valueOf(0.75));
        builder.withFullMoneyService((goods) -> BigDecimal.valueOf(5));
        ActivityFacade factory = builder.build();

        String goodsId = "123";
        BigDecimal money = BigDecimal.valueOf(100);

        Goods goods = new Goods() {
            @Override
            public <T> T getId() {
                return  (T)"123";
            }
BigDecimal price = BigDecimal.valueOf(100);
            @Override
            public BigDecimal getPrice() {
                return  price;
            }
        };
        money = factory.discount(goods, money);
        System.out.println("money:" + money);
        money = factory.descend(goods, money);
        System.out.println("money:" + money);

        money = factory.fullMoney("shopId", goods,money );
        System.out.println("money:" + money);

    }
}
